package com.hangxiang.approval.controller;

import com.hangxiang.approval.common.*;
import com.hangxiang.approval.service.ActiongroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Actiongroup)表控制层
 *
 * @author makejava
 * @since 2020-11-23 18:07:47
 */
@RestController
@RequestMapping("actiongroup")
@Api(tags = "审批流程相关功能")
public class ActiongroupController {
    /**
     * 服务对象
     */
    @Resource
    private ActiongroupService actiongroupService;

//    /**
//     * 通过主键查询单条数据
//     *
//     * @param common
//     * @return 单条数据
//     */
//    @PostMapping("selectAllInfo")
//    @ApiOperation(value = "通过查询数据")
//    @ResponseBody
//    public ResultBean selectAllInfo(@RequestBody @Validated ActionGroupPageCommon common) {
//        return ResultBean.success(actiongroupService.selectAllInfo(common));
//    }

    /**
     * 通过主键查询单条数据
     *
     * @param common 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    @ApiOperation(value = "通过主键查询单条数据")
    @ResponseBody
    public ResultBean selectOne(@RequestBody @Validated IntegerCommon common) {
        return ResultBean.success(actiongroupService.queryById(common));
    }



    /**
     * 新增数据
     *
     * @param actiongroupInsertCommon 实例对象
     * @return 实例对象
     */
    @PostMapping("insertActiongroup")
    @ApiOperation(value = "添加数据")
    @ResponseBody
    public ResultBean insert(@RequestBody @Validated List<ActiongroupInsertCommon> actiongroupInsertCommon) {
        return ResultBean.success(actiongroupService.insertActiongroup(actiongroupInsertCommon));
    }

    /**
     * 新增数据
     *
     * @param actiongroupUpdateCommon 实例对象
     * @return 实例对象
     */
    @PostMapping("updateActiongroup")
    @ApiOperation(value = "修改数据")
    @ResponseBody
    public ResultBean update(@RequestBody @Validated ActiongroupUpdateCommon actiongroupUpdateCommon) {
        return ResultBean.success(actiongroupService.updateActiongroup(actiongroupUpdateCommon));
    }


}